package com.bbh.plugin.single.privilege.core.vo;

import com.bbh.common.domain.Page;

import java.io.Serializable;
import java.util.List;

public class JQGridVo<T> implements Serializable {
    private List<T> rows;
    /**
     * 总页数
     */
    private Integer total;
    /**
     * 当前页
     */
    private Integer page;
    /**
     * 总记录数
     */
    private Long records;


    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page == null || 0 == page ? 1 : page;
    }

    public Long getRecords() {
        return records;
    }

    public void setRecords(Long records) {
        this.records = records;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public JQGridVo() {
    }

    public JQGridVo(Page page) {
        this.page = page.getPageNum();
        this.total = page.getPages();
        this.rows = page.getList();
        this.records = page.getTotal();
    }
}

